<template>
	<view class="" style="padding: 7px;background-color: #FAFAFA;height: 100vh;">
		<view class="header">
			<view class="header_one" @click="xs">
				<view class="header_qian">
					<!-- <image src="../../static/images/home/grid-icon/39.png" mode=""></image> -->
					<text>玩法参数设置</text>
				</view>
				<image src="../../static/xiajiantou.png" mode="widthFix"></image>
			</view>
			<view v-if="isshow">
				<view class="header_gz" @click="gz">
					<text style="margin-right: 20%;">赔率规则</text>
					<text class="header_tj">添加规则</text>
				</view>

				<view class="kuang" v-if="show">
					<view style="display: flex;justify-content: space-around;align-items: center;">
						<view style="margin-top: 5px;">
							<switch @change="switch2Change" />
						</view>
						<view style="margin-top: 5px;"><input type="text" value="" v-model="nametitle" style="width: 100px;text-align: center;"
							 placeholder="请输入名称" /></view>
						<view style="display: flex;flex-direction: row;align-items: center;">
							<view style="margin-top: 5px;color: #f20;margin-right: 5px;" @click="save">保存</view>
							<view style="margin-top: 5px;" @click="delitem">删除</view>
						</view>
					</view>
					<view class="twotitle">
						<view class="twochild">
							<text>玩法</text>
							<picker @change="bindPickerChange" :value="wf_status" :range="array">
								<view class="picker_view">
									<view class="uni-input">{{array[wf_status]}}</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>
							</picker>

						</view>
						<view class="twochild">
							<text style="margin-right: 5px;">包数</text>
							<picker @change="bindPickerChange1" :value="b_num" :range="array1">
								<view class="picker_view">
									<view class="uni-input">{{array1[b_num]}}包</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>
							</picker>
						</view>
					</view>
					<view class="twotitle">
						<view class="twochild">
							<text>免死设置</text>
							<picker @change="bindPickerChange2" :value="wf_ms" :range="array2">
								<view class="picker_view">
									<view class="uni-input">{{array2[wf_ms]}}</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>
							</picker>
						</view>
					</view>
					<view class="threecont">
						<view class="">
							雷包金额
						</view>
						<view class="header_lb">
							<input type="number" value="00" v-model="lb_min"  />-<input type="number" value="00" style=""
							 v-model="lb_max"  />
						</view>
					</view>
					<!-- 					<view class="threecont">
						<view class="">
							中雷赔率
						</view>
						<view class="header_lb">
							<input type="text" value="00" style="" v-model="pl" />
						</view>
					</view> -->
					<!-- <view class="threecont" style="margin-bottom: 10px;">
						<view class="">
							群主提点比例
						</view>
						<view class="header_lb">
							<input type="text" value="00" style="" v-model="bl" />
						</view>
					</view> -->
					<view class="twotitle" v-show="wf_ms!=0">
						<view class="twochild">
							<text>指定免死</text>
							<picker @change="bindPickerChange3" :value="ms_zd" :range="accountArr">
								<view class="picker_view">
									<view class="uni-input">{{accountArr[ms_zd]}}</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>
							</picker>
						</view>
					</view>
					<!-- 	<view style="margin-left: 20px;">注:群主设置没有抢包的红包</view>
					<view v-for="(item,index) in list1">
						<view class="radio" style="margin-left: 20px;display: flex;justify-content: flex-start;margin-top: 10px;">
							<checkbox  :value="item.val" @click="toval(item,index)"/>
							<text style="margin-left: 15px;">{{item.msg}}</text>
							<view class="header_lb" style="margin-left: 15px;">
								<input type="text" value="" style="" v-model="item.beishu" />
							</view>
							<text style="margin-left: 15px;">秒延迟</text>
							<image src="../../static/img/shanchu.png" mode="widthFix" style="width: 20px;height: 20px;" @click="shanchu2(item)"></image>
						</view>
						
					</view>
					<view style="display: flex;justify-content: center;" @click="totianjia">
						<image src="../../static/add.png" mode="" style="width: 30px;height: 30px;display: flex;justify-content: center;"></image>
					</view> -->

					<view class="header_pl">赔率设置</view>
					<view style="display: flex;justify-content: center;" @click="totianjia1">
						<image src="/static/add.png" mode="" style="width: 30px;height: 30px;display: flex;justify-content: center;"></image>
					</view>
					<!-- 单雷 -->
					<view class="threecont" v-if="wf_status==1">
						<view class="picker_view" >
							每中一个的赔率为:
						</view>

						<view class="header_bs">
							<input type="number" value=""  v-model="beishu"/>倍
						</view>
					</view>
					<!-- <view>{{index}}</view> -->
					<!-- 连环了 -->
					<view class="threecont" v-if="wf_status==2" v-for="item in list3">
						<view class="picker_view" @click="wf_statusclick1(item)">
							<input type="text" v-model="item.msg" placeholder="请选择" disabled style="width: 70px;" />
							<image src="../../static/xiajiantou.png" mode="widthFix"></image>
						</view>

						<view class="header_bs">
							赔<input type="number" value="" v-model="item.beishu" />倍
							<image src="../../static/img/shanchu.png" mode="widthFix" @click="shanchu1(item,index)"></image>
						</view>
					</view>
				</view>
				<view class="" style="background-color: #FFFFFF;padding: 10px;border-radius: 10px;margin-top: 20px;" v-for="(item,index) in savelist"
				 :key="index">
					<view class="kuang">
						<view style="display: flex;justify-content: space-around;align-items: center;">
							<!-- <view style="margin-top: 5px;" :class="[item.defult==1?'redtext':'']">启用</view> -->
							<view style="margin-top: 5px;">
								<switch :checked="item.defult == 1 ? true : false" />
							</view>
							<view style="margin-top: 5px;">{{item.title}}</view>
							<view style="display: flex;flex-direction: row;align-items: center;">
								<!-- 		<view style="margin-top: 5px;" @click="save">保存</view> -->
								<view style="margin-top: 5px;" @click="del(item,index)">删除</view>
							</view>
						</view>
						<view class="twotitle">
							<view class="twochild">
								<text>玩法</text>

								<view class="picker_view">
									<view class="uni-input">{{array[item.wf_status]}}</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>


							</view>
							<view class="twochild">
								<text style="margin-right: 5px;">包数</text>

								<view class="picker_view">
									<view class="uni-input">{{item.b_num}}包</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>

							</view>
						</view>
						<view class="twotitle">
							<view class="twochild">
								<text>免死设置</text>

								<view class="picker_view">
									<view class="uni-input">{{array2[item.wf_ms]}}</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>

							</view>
						</view>
						<view class="threecont">
							<view class="">
								雷包金额
							</view>
							<view class="header_lb">
								<input type="text" :value="item.lb_min" />-<input type="text" :value="item.lb_max" style="" />
							</view>
						</view>
						<!-- 						<view class="threecont">
							<view class="">
								中雷赔率
							</view>
							<view class="header_lb">
								<input type="text" :value="item.pl" style="" />
							</view>
						</view> -->
						<view class="twotitle" v-show="item.wf_ms==1">
							<view class="twochild">
								<text>指定免死</text>

								<view class="picker_view">
									<view class="uni-input">{{item.ms_zd}}</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>

							</view>
						</view>
						<view class="header_pl">赔率设置</view>
						<!-- 单雷 -->
						<view class="threecont" v-if="item.wf_status==1" v-for="list in item.pllist">
							<view class="picker_view" >
								每中一个的赔率为:
							</view>
							
							<view class="header_bs">
								{{list.pl}}倍
							</view>
						</view>
						<!-- 连环了 -->
						<view class="threecont" v-if="item.wf_status==2" v-for="list in item.pllist">
							<picker @change="bindPickerChange4" :value="index4" :range="lianhuanlei">
								<view class="picker_view">
									<view class="uni-input">{{lianhuanlei[list.bs-2]}}</view>
									<image src="../../static/xiajiantou.png" mode="widthFix"></image>
								</view>
							</picker>
							<view class="header_bs">
								赔{{list.pl}}倍
								<image src="../../static/img/shanchu.png" mode="widthFix"></image>
							</view>
						</view>
					</view>
				</view>
			</view>


		</view>


		<view class="header" style="margin-top: 10px;">
			<view class="header_one" @click="hb">
				<view class="header_qian">
					<!-- <image src="/static/images/home/grid-icon/39.png" mode=""></image> -->
					<text>福利</text>
				</view>
				<image src="/static/xiajiantou.png" mode=""></image>
			</view>
			<view style="margin-top: 10px;font-size: 14px;" v-if="Show">
					<t-table >
						<t-tr>
							<t-th>用户玩家</t-th>
							<t-th>发包流水</t-th>
							<t-th>抢包流水</t-th>
							<t-th>最低流水</t-th>
							<t-th>比例</t-th>
							<t-th>选择用户</t-th>
						</t-tr>
						<t-tr>
							<t-td></t-td>
							<t-td></t-td>
							<t-td></t-td>
							<t-td><input type="number" value=""  v-model="jien" @blur="tofun()" placeholder="流水"/></t-td>
							<t-td><input type="number" value=""  v-model="bili" style="width: 30px;" maxlength='2' @blur="tofun1()" />%</t-td>
							<t-td>点击切换</t-td>
						</t-tr>
						<t-tr v-for="(it,ind) in fulishezhi" :key="ind">
							<t-td>{{it.nickname}}</t-td>
							<t-td>{{it.fb}}</t-td>
							<t-td>{{it.qb}}</t-td>
							<t-td>{{jien}}以上</t-td>
							<t-td>{{bili}}%</t-td>
							<t-td><view class="uni-input" @click="clickperson(it)">{{it.fafl_status==1?'本人':'上家'}}</view></t-td>
						</t-tr>
					</t-table>
					<view style="text-align: center;margin-top: 10px;" @click="toff">确认发放福利</view>
				</view>
		</view>
		<!-- 抽成设置 -->
		<view class="header" style="margin-top: 10px;">
			<view class="header_one" @click="choucheng">
				<view class="header_qian">
					<!-- <image src="/static/images/home/grid-icon/39.png" mode=""></image> -->
					<text>抽成设置</text>
				</view>
				<image src="/static/xiajiantou.png" mode=""></image>
			</view>
			<view style="margin-top: 10px;font-size: 14px;" v-if="chou">
				<view style="display: flex;justify-content: space-between;align-items: center;">
					<text>抽成</text>
					<view style="display: flex;flex-direction: row;">
						<input type="number" value="" placeholder="请输入抽成比例" style="text-align: right;" @blur="upbili" />%
					</view>
					
				</view>
				<view style="display: flex;justify-content: space-between;align-items: center;">
					<text>当前抽成比例</text>
					<view style="display: flex;flex-direction: row;">
						{{numbili}}%
					</view>
					
				</view>
			</view>
		</view>
		
		<view class="header" style="margin-top: 10px;">
			<view class="header_one" @click="qbsshezhi">
				<view class="header_qian">
					<!-- <image src="/static/images/home/grid-icon/39.png" mode=""></image> -->
					<text>抢包手设置</text>
				</view>
				<image src="/static/xiajiantou.png" mode=""></image>
			</view>
			<view style="margin-top: 10px;" v-if="qbshow">
				<view style="margin-left: 20px;display: flex;justify-content: space-between;"><text>注:群主设置没有抢完的红包</text>
					<view>
						<text style="color: #FF2200;margin-right: 10px;" @click="qbsave">保存</text>
						<text @click="delqb">删除</text>
					</view>
				</view>
				<view style="margin-left: 20px;display: flex;justify-content: space-between;">
					<text>抢包手</text>
					<view class="header_lb" style="margin-left: 15px;">
						<input type="text" value="" style="width: 100px;" v-model="q_miao" @blur="tohx(q_miao)" />
					</view>
					<text>分延迟抢包</text>
				</view>
				<view v-for="(item,index) in list1" :key="index">
					<view class="radio" style="margin-left: 20px;display: flex;justify-content: flex-start;margin-top: 10px;">
						<!-- <checkbox :value="item.val" @click="toval(item,index)" @change="qbchange" /> -->
						<text style="margin-right: 15px;">{{item.msg}}</text>
						<!-- <view class="header_lb" style="margin-left: 15px;"> -->
							<input type="text" value="" style="width: 50px;text-align: center;border-bottom: 1px solid #000000;" v-model="q_miao" disabled/>
						<!-- </view> -->
						<text style="margin-left: 15px;">分延迟</text>
						<image src="../../static/img/shanchu.png" mode="widthFix" style="width: 20px;height: 20px;margin-left: 60rpx;" @click="shanchu2(item,index)"></image>
					</view>
				</view>
				<view v-for="(items,indexs) in huixian" :key="indexs">
					<view class="radio" style="margin-left: 20px;display: flex;justify-content: flex-start;margin-top: 10px;">
						<!-- <checkbox :value="items" @click="toval(items,index)" @change="qbchange" :checked="items" /> -->
						<text style="margin-right: 15px;">{{items.account}}</text>
						<!-- <view class="header_lb" style="margin-left: 15px;"> -->
							<input type="number" value="" style="width: 50px;text-align: center;border-bottom: 1px solid #000000;" v-model="q_miao" disabled/>
						<!-- </view> -->
						<text style="margin-left: 15px;">分延迟</text>
						<image src="../../static/img/shanchu.png" mode="widthFix" style="width: 20px;height: 20px;margin-left: 60rpx;" @click="shanchu2(items,indexs)"></image>
					</view>
				</view>
				<view style="display: flex;justify-content: center;" @click="totianjia">
					<image src="../../static/add.png" mode="" style="width: 30px;height: 30px;display: flex;justify-content: center;"></image>
				</view>

			</view>
		</view>
		<view class="header" style="margin-top: 10px;">
			<view class="header_one" @click="guoqitime">
				<view class="header_qian">
					<!-- <image src="/static/images/home/grid-icon/39.png" mode=""></image> -->
					<text>设置红包过期时间</text>
				</view>
				<image src="/static/xiajiantou.png" mode=""></image>
			</view>
			<view style="margin-top: 10px;" v-if="timeshow">
					<view style="display: flex;justify-content: space-between;align-items: center;">
						<text>设置过期时间</text>
						<view style="display: flex;flex-direction: row;">
							<input type="number" value="" placeholder="请输入退回时间" style="text-align: right;" @blur="uptime" />分钟
						</view>
						
					</view>
					<view style="display: flex;justify-content: space-between;align-items: center;">
						<text>当前过期时间</text>
						<view style="display: flex;flex-direction: row;">
							{{stime}}分钟
						</view>
						
					</view>
			</view>
		</view>
		<wyb-popup ref="wf_status" type="bottom" width="700" radius="6" :showCloseIcon="true">
			<scroll-view scroll-y="true" style="height: 170px;margin-top: 10px;margin-bottom: 10px;">
				<view class="popup-content" v-for="(item,index) in array4" :key='index'>
					<view scroll-y="true" @click="xuanstatus(item,index)">
						<view> {{item}}</view>
					</view>
				</view>
			</scroll-view>
		</wyb-popup>
		<wyb-popup ref="wf_status1" type="bottom" width="700" radius="6" :showCloseIcon="true">
			<scroll-view scroll-y="true" style="height: 170px;margin-top: 10px;margin-bottom: 50px;">
				<view class="popup-content" v-for="(item,index) in lianhuanlei" :key='index' style="margin-bottom: 5px;">
					<view scroll-y="true" @click="xuanstatus1(item,index)">
						<view> {{item}}</view>
					</view>
				</view>
			</scroll-view>
		</wyb-popup>
	</view>
</template>

<script>
	import tTable from '@/components/t-table/t-table.vue';
	import tTh from '@/components/t-table/t-th.vue';
	import tTr from '@/components/t-table/t-tr.vue';
	import tTd from '@/components/t-table/t-td.vue';
	import wybPopup from '@/components/wyb-popup/wyb-popup.vue'
	export default {
		components: {
			wybPopup,
			tTable,
			tTh,
			tTr,
			tTd
		},
		data() {
			return {
				array: ['请选择','单雷', '连环雷'],
				array6: ['请选择','本家', '上家'],
				array1: ['请选择', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'],
				array2: ['关闭', '开启'],
				array3: ['用户1', '用户2'],
				array4: ['中一个', '中两个', '中三个', '中四个', '中五个', '中六个', '中七个', '中八个', '中九个','中十个'],
				array5: ['中四个', '中五个', '中六个'],
				lianhuanlei: ['二中二', '三中三', '四中四', '五中五', '六中六', '七中七', '八中八', '九中九', '十中十'],
				lb_min: '',
				lb_max: '',
				pl: '',
				beishu:'',
				huixian: [],
				accountArr: [],
				wf_status: 0,
				b_num: 0,
				wf_ms: 0,
				ms_zd: 0,
				status: 2,
				index: 0,
				index4: 0,
				index5: 0,
				isshow: false,
				show: false,
				Show: false,
				roomid: '',
				nametitle: '',
				defult: '',
				gz_xh: '',
				savelist: [],
				hylist: [],
				newhaoyou: [],
				list1: [],
				list2: [],
				list3: [],
				num: 1,
				num1: 1,
				bl: '',
				ms_yonghu: '',
				jien: '',
				bili: '',
				fulishezhi: [],
				msg: '',
				arr: '',
				qbshow: false,
				pl_one: [],
				newArr: [],
				jiqi: [],
				jiqiren: [],
				xzstatus: '',
				numbs: '',
				index6: 0,
				title: '',
				numid: 0,
				fuli: false,
				fulishezhi: '',
				chou:false,
				numbili:'',
				topfuli:[],
				timeshow:false,
				stime:'',
				q_miao:0,
				yuan_miao:0
			}
		},
		onShow() {
			this.tock()
		},
		onLoad(option) {
			console.log(option.roomid)
			this.roomid = option.roomid
			let token = uni.getStorageSync("token")
			uni.request({
				url: this.G_base + '/api/lz/qgzinfo',
				method: 'POST',
				header: {
					'content-type': 'application/x-www-form-urlencoded',
					'Authori-zation': 'Bearer ' + token
				},
				data: {
					qid: this.roomid,
				},
				success: res => {
					console.log(res)
					console.log(res.data.data[0].status)
					this.xzstatus = res.data.data[0].status
					console.log("现在的群的状态时什么群")
				}
			})
			//获取抢包手主力
			uni.request({
				url: this.G_base + '/api/lz/qqbsdq',
				method: 'POST',
				header: {
					'content-type': 'application/x-www-form-urlencoded',
					'Authori-zation': 'Bearer ' + token
				},
				data: {
					id: this.roomid,
					type: 1,
				},
				success: res => {
					console.log(res)
					this.huixian = res.data.data
					if(res.data.data!=[]){
						this.q_miao=res.data.data[0].miao
						this.yuan_miao=res.data.data[0].miao
					}else{
						this.q_miao=0
						this.yuan_miao=0
					}
					console.log("现在群里面的抢包手主力")
				}
			})
			uni.request({
				url: this.G_base + '/api/lz/qgzinfo',
				method: 'POST',
				header: {
					'content-type': 'application/x-www-form-urlencoded',
					'Authori-zation': 'Bearer ' + token
				},
				data: {
					qid: this.roomid,
				},
				success: res => {
					this.savelist = res.data.data
					console.log(res)
				}
			})
			uni.request({
				url: this.G_base + '/api/lz/qyinfo',
				method: "POST",
				data: {
					id: this.roomid
				},
				header: {
					'content-type': 'application/x-www-form-urlencoded',
					'Authori-zation': 'Bearer ' + token
				},
				success: (res) => {
					console.log(res);
					console.log("所有的成员展示信息")
					for (let i = 0; i < res.data.data.qy.length; i++) {
						this.accountArr.push(res.data.data.qy[i].account)
					}
					console.log(this.accountArr)
					console.log("自身的群所有的成员信息")
				},
				fail: (err) => {
					console.log(err)

				}
			});
			// 获取好友列表
			uni.request({
				url: this.G_base + '/api/lz/hlist',
				method: 'POST',
				header: {
					'content-type': 'application/x-www-form-urlencoded',
					'Authori-zation': 'Bearer ' + token
				},
				success: res => {
					console.log(res)
					console.log(res.data.data)
					this.hylist = res.data.data
					for (let i = 0; i < res.data.data.length; i++) {
						if (res.data.data[i].brands.length != 0) {
							console.log(res.data.data[i])
							this.newhaoyou.push(res.data.data[i])
						}

					}

				}
			})
			console.log(this.newhaoyou)
			console.log("所有好友")
		},
		methods: {
			tofun() {
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/SetWelfare',
					method: 'POST',
					data: {
						draw_percentage: this.jien,
						qid: this.roomid,
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: res => {
						console.log(res)
						if (res.data.status == 200) {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}

					}
				})
			},
			tofun1() {
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/SetWelfare',
					method: 'POST',
					data: {
						satisfy: this.bili,
						qid: this.roomid,
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: res => {
						console.log(res)
						if (res.data.status == 200) {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}

					}
				})
			},

			toff() {
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/qfwafare',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					data: {
						qid: this.roomid,
					},
					success: res => {
						console.log(res)
						if(res.data.status==200){
							uni.showToast({
								title:"发放成功"
							})
							setTimeout(()=>{
								uni.navigateBack({
									delta:1
								})
							},1000)
						}
						console.log('发放!!!!!!!!!!!!!!')
					}
				})
			},

			tock1() {
				this.fuli = true
			},

			hb() {
				if (this.Show == true) {
					this.Show = false
				} else {
					this.Show = true
				}
			},
			choucheng(){
				if (this.chou == true) {
					this.chou = false
				} else {
					this.chou = true
					let token = uni.getStorageSync("token")
					uni.request({
						url: this.G_base + '/api/lz/qzcchq',
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded',
							'Authori-zation': 'Bearer ' + token
						},
						data: {
							id: this.roomid,
					
						},
						success: res => {
							console.log(res)
							this.numbili = res.data.data.qzcc
							console.log("比例抽成设置")
						}
					})
				}
			},
			tock() {
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/GetWelfare',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					data: {
						qid: this.roomid,

					},
					success: res => {
						console.log(res)
						// this.topfuli = res.data.data.qflz
						this.jien = res.data.data.qflz.draw_percentage
						this.bili = res.data.data.qflz.satisfy
						
						this.index6 = res.data.data.qflz.fafl_status
						// console.log(this.index6)
						this.fulishezhi = res.data.data.qyls
						console.log("游戏福利")
					}
				})
			},
			bindPickerChange6(e) {
				// console.log('picker发送选择改变，携带值为', e.target.value+1)
				this.index6 = e.target.value
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/SetWelfare',
					method: 'POST',
					data: {
						status: e.target.value,
						qid: this.roomid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: res => {
						console.log(res)
						if (res.data.status == 200) {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}

					}
				})
			},
			tohx(e) {
				console.log(e)
				if(e!=this.yuan_miao){
					let token = uni.getStorageSync('token')
					uni.request({
						url: this.G_base + '/api/lz/qqbsup',
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded',
							'Authori-zation': 'Bearer ' + token
						},
						data: {
							hxq_id: this.roomid,
							type: 1,
							miao: e
						},
						success: res => {
							console.log(res)
							if (res.data.status == 200) {
								this.yuan_miao=e
								uni.showToast({
									title: res.data.msg,
									icon: 'none'
								})
							} else {
								uni.showToast({
									title: res.data.msg,
									icon: 'none'
								})
							}

						}
					})
				}
			},
			clickperson(e){
				let token = uni.getStorageSync('token')
				uni.request({
					url: this.G_base + '/api/lz/setWelfared',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					data: {
						qid: this.roomid,
						uid: e.uid,
						status: e.fafl_status==1?0:1,
					},
					success: res => {
						if (res.data.status == 200) {
							e.fafl_status = e.fafl_status==1?0:1;
							uni.showToast({
								title: '操作成功'
							})
						}
					}
				})
			},
			qbchange(e) {
				console.log(e)
			},
			qbsave() {
				console.log(this.list1)
				for (let i = 0; i < this.list1.length; i++) {
					console.log(i)
					this.jiqi.push(this.list1[i].msg + ':' + this.list1[i].beishu)


				}
				let oldArr = this.jiqi
				this.jiqiren = oldArr.join(",")
				console.log(this.jiqiren)
				let token = uni.getStorageSync('token')
				uni.request({
					url: this.G_base + '/api/lz/qqbs',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					data: {
						id: this.roomid,
						jltxt: this.jiqiren,
						status: 1,
					},
					success: res => {
						console.log(res)
						if (res.data.status == 200) {
							uni.showToast({
								title: '操作成功'
							})
						}
						this.qbshow =false
						console.log("设置抢包手主力完成")
						setTimeout(()=>{
							uni.navigateBack({
								delta:1
							})
						},500)

					}
				})
			},
			//修改比例
			upbili(e){
				console.log(e)
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/qzccup',
					method: 'POST',
					data: {
						ccbl: e.detail.value,
						id: this.roomid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: res => {
						console.log(res)
						if (res.data.status == 200) {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
							this.choucheng();
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}
				
					}
				})
			},
			//设置过期时间
			uptime(e){
				console.log(e.detail.value)
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/setTui',
					method: 'POST',
					data: {
						hb_tui: e.detail.value,
						qid: this.roomid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: res => {
						console.log(res)
						if (res.data.status == 200) {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
							this.qbshow();
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}
				
					}
				})
			},
			delqb() {
				this.list1 = []
			},
			tofun(e) {
				console.log(e)
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/SetWelfare',
					method: 'POST',
					data: {
						draw_percentage: this.jien,
						qid: this.roomid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: res => {
						console.log(res)
						if (res.data.status == 200) {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}

					}
				})
			},
			tofun1(e) {
				console.log(e)
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/SetWelfare',
					method: 'POST',
					data: {
						satisfy: this.bili,
						qid: this.roomid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					success: res => {
						console.log(res)
						if (res.data.status == 200) {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						} else {
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}

					}
				})
			},

			toval(e, index) {
				console.log(e, index)
				if (e.check == 0) {
					this.list1[index].check = 1
				} else {
					this.list1[index].check = 0
				}
				console.log(this.list1)
			},
			shanchu(msg) {
				console.log(msg)
				for (let i = 0; i < this.list2.length; i++) {
					if (msg.msg == this.list2[i].msg) {
						this.list2.splice(i, 1)
					}
				}
			},
			shanchu1(msg) {
				console.log(msg)
				for (let i = 0; i < this.list3.length; i++) {
					if (msg.msg == this.list3[i].msg) {
						this.list3.splice(i, 1)
					}
				}
			},
			shanchu2(msg,key) {
				let token = uni.getStorageSync("token")
				uni.request({
					url: this.G_base + '/api/lz/qqbsdel',
					method: 'POST',
					header: {
						'content-type': 'application/x-www-form-urlencoded',
						'Authori-zation': 'Bearer ' + token
					},
					data: {
						id: msg.id,
					},
					success: res => {
						if(res.data.status==200){
							this.huixian.splice(key, 1);
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}
					}
				})
				
				// for (let i = 0; i < this.list1.length; i++) {
				// 	if (msg.msg == this.list1[i].msg) {
				// 		this.list1.splice(i, 1)
				// 		this.num1 = this.num1 - 1
				// 	}
				// }
			
			},
			wf_statusclick1(e) {
				this.msg = e
				this.$refs.wf_status1.show()
			},
			xuanstatus1(msg, index) {
				// console.log(msg, index)
				this.msg.msg = msg
				this.msg.val = index + 1
				this.$refs.wf_status1.close()
			},
			xuanstatus(msg, index) {
				this.msg.msg = msg
				this.msg.val = index + 1
				this.$refs.wf_status.close()
			},
			wf_statusclick(e) {
				// console.log(e)
				this.msg = e
				if (this.msg == 0) {
					//单雷

				} else if (this.msg == 1) {
					//连环雷
				} else if (this.msg == 2) {
					//不中雷
				}
				this.$refs.wf_status.show()
			},
			totianjia1() {
				if (this.index == 1) {
					this.list2.push({
						beishu: '',
						msg: '',
						val: ''
					})
					this.num = this.num + 1
					console.log(this.list2)
				} else if(this.index == 2) {
					this.list3.push({
						beishu: '',
						msg: '',
						val: ''
					})
					this.num = this.num + 1
					console.log(this.list3)
				}
			},
			totianjia() {
				for (var num = this.num1; num <= this.huixian.length - 0; num++) {
					this.num1 = this.huixian.length - 0
				}
				this.num1 = this.num1 + 1

				this.list1.push({
					beishu: '',
					msg: '抢包助手' + this.num1,
					val: 'r' + this.num1,
					check: 0
				})
				console.log(this.list1)
			},
			bindPickerChange: function(e) {
				console.log(e)
				this.wf_status = e.target.value
				this.index = e.target.value
			},
			bindPickerChange1: function(e) {
				console.log(e)
				this.b_num = e.target.value
			},
			bindPickerChange2: function(e) {
				// for (let i = 0; i < this.newhaoyou.length; i++) {
				// 	console.log(this.newhaoyou[i].brands[i])
				// 	this.accountArr.push(this.newhaoyou[i].brands)
				// }
				console.log("你所需要的值")
				console.log(e.detail.value)
				this.wf_ms = e.detail.value
			},
			bindPickerChange3: function(e) {
				console.log(this.accountArr[e.detail.value])
				console.log(e)
				console.log("取到的第几位的")
				this.ms_zd = e.target.value
				this.ms_yonghu = this.accountArr[e.detail.value]
			},
			bindPickerChange4: function(e) {
				console.log(e)
				this.index4 = e.target.value
			},
			bindPickerChange5: function(e) {
				console.log(e)
				this.index5 = e.target.value
			},
			delitem() {
				this.show = !this.show
				this.lb_min = ''
				this.lb_max = ''
				this.pl = ''
				this.nametitle = ''
				this.defult = 0
			},

			del(msg, num) {
				console.log(msg)
				console.log(num)
				if (msg.id == this.savelist[num].id) {
					this.savelist.splice(num, 1)
					console.log(true)
					let token = uni.getStorageSync("token")
					uni.request({
						url: this.G_base + '/api/lz/delqgz',
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded',
							'Authori-zation': 'Bearer ' + token
						},
						data: {
							qid: this.roomid,
							id: msg.id
						},
						success: res => {
							console.log(res)
							uni.showToast({
								title: res.data.msg,
								icon: 'none'
							})
						}
					})
				}


			},
			save() {
				if (this.wf_status == 2) {
					for (let i = 0; i < this.list3.length; i++) {
						console.log(i)
						this.pl_one.push(this.list3[i].val + 1 + ':' + this.list3[i].beishu)
					}
					let oldArr = this.pl_one
					this.newArr = oldArr.join(",")
					console.log(this.newArr)
				} else if (this.wf_status == 1) {
						this.pl_one.push(1 + ':' + this.beishu)
	
					let oldArr = this.pl_one
					this.newArr = oldArr.join(",")
					console.log(this.newArr)
				}
				if (this.nametitle == '') {
					uni.showToast({
						title: '请输入规则名称',
						icon: 'none'
					})
					return
				} else if (this.lb_min == '' && this.lb_max == '') {
					uni.showToast({
						title: '请输入金额',
						icon: 'none'
					})
					return
				} else if(this.pl_one.length==0){
					uni.showToast({
						title: '请设置赔率规则',
						icon: 'none'
					})
					return
				}else {
					let token = uni.getStorageSync("token")
					uni.request({
						url: this.G_base + '/api/lz/qgzcreat',
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded',
							'Authori-zation': 'Bearer ' + token
						},
						data: {
							q_id: this.roomid,
							wf_status: this.wf_status,
							b_num: this.b_num,
							wf_ms: this.wf_ms,
							ms_zd: this.ms_yonghu,
							lb_min: this.lb_min,
							lb_max: this.lb_max,
							pl_one: this.newArr,
							title: this.nametitle,
							gz_xh: 2,
							defult: this.defult,
							status:2
						},
						success: res => {
							console.log(res)
							uni.showToast({
								title: res.data.msg
							})
							setTimeout(() => {
								uni.navigateBack({
									delta: 1
								})
							}, 1000)
						}
					})
				}

			},
			xs() {
				if (this.isshow == true) {
					this.isshow = false
				} else {
					this.isshow = true
				}
			},
			guoqitime(){
				if (this.timeshow == true) {
					this.timeshow = false
				} else {
					this.timeshow = true
					let token = uni.getStorageSync("token")
					uni.request({
						url: this.G_base + '/api/lz/getTui',
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded',
							'Authori-zation': 'Bearer ' + token
						},
						data: {
							qid: this.roomid,
					
						},
						success: res => {
							console.log(res)
							console.log("所需要的时间显示")
							this.stime = res.data.data.hb_tui
					
						}
					})
				}
			},
			gz() {
				this.show = true
			},
			switch2Change: function(e) {
				console.log('switch2 发生 change 事件，携带值为', e.target.value)
				if (e.target.value == true) {
					this.defult = 1
				} else {
					this.defult = 0
				}
			},
			qbsshezhi() {
				if (this.qbshow == true) {
					this.qbshow = false
				} else {
					this.qbshow = true
				}
			},
			hb() {
				if (this.Show == true) {
					this.Show = false
					let token = uni.getStorageSync("token")
					uni.request({
						url: this.G_base + '/api/lz/GetWelfare',
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded',
							'Authori-zation': 'Bearer ' + token
						},
						data: {
							qid: this.roomid,

						},
						success: res => {
							console.log(res)
							// this.topfuli = res.data.data.qflz
							this.jien = res.data.data.qflz.draw_percentage
							this.bili = res.data.data.qflz.satisfy
							
							this.index6 = res.data.data.qflz.fafl_status
							this.fulishezhi = res.data.data.qyls
							console.log("游戏福利")

						}
					})
				} else {
					this.Show = true
					let token = uni.getStorageSync("token")
					uni.request({
						url: this.G_base + '/api/lz/GetWelfare',
						method: 'POST',
						header: {
							'content-type': 'application/x-www-form-urlencoded',
							'Authori-zation': 'Bearer ' + token
						},
						data: {
							qid: this.roomid,

						},
						success: res => {
							console.log(res)
							this.jien = res.data.data.qflz.draw_percentage
							this.bili = res.data.data.qflz.satisfy
							
							this.index6 = res.data.data.qflz.fafl_status
							this.fulishezhi = res.data.data.qyls
							console.log("游戏福利")

						}
					})
				}
			}
		},
	}
</script>

<style scoped>
	.popup-content {
		text-align: center;
		padding: 5px 0;
		margin-top: 5px;
	}

	select {
		width: 55px;
		height: 2rem;
		border: 1px solid #FFFFFF;
		/*内容居中显示*/
		text-align: center;
		text-align-last: center;
		border-radius: 2px;
		background-color: #FFFFFF;

	}

	* {
		font-size: 16px;
	}

	page {
		background-color: #FAFAFA;
	}

	.header {
		background-color: #FFFFFF;
		border-radius: 10px;
		padding: 10px;
	}

	.header_one {
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.header_qian {
		display: flex;
		align-items: center;
	}

	.header_one image {
		width: 30px;
		height: 30px
	}

	.header_qian image {
		width: 45px;
		height: 45px;
	}

	.header_gz {
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}

	.header_tj {
		background: -webkit-linear-gradient(left, #a00000, #e10004, #a00000);
		color: #FFFFFF;
		padding: 6px;
		border-radius: 20px;
		font-size: 14px;
	}

	.kuang view {
		padding: 1px;
	}

	.kuang {
		border-style: dotted dotted dotted dotted;
		border-color: #FAFAFA;
		height: 100%;
		width: 100%;
		font-size: 14px;
		/* margin: 10px; */

	}

	.twotitle {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 5px;
	}

	.twochild {
		margin-left: 20px;
		margin-right: 20px;
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.picker_view {
		display: flex;
		justify-content: center;
		align-items: center;
		margin-left: 5px;
		background-color: #FAFAFA;
	}

	.picker_view image {
		width: 20px;
		height: 20px;
	}

	.threecont {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-left: 20px;
		margin-right: 20px;
		margin-top: 10px;
	}

	.bottomcontent {
		/* display: flex;
		justify-content: flex-start; */
		margin-left: 20px;
	}

	.header_lb {
		display: flex;
		flex-direction: row;
	}

	.redtext {
		color: #F20;
	}

	.header_lb input {
		background-color: #e7e7e7;
		width: 50px;
		text-align: center;
	}

	.header_wf {
		display: flex;
		justify-content: flex-start;
	}

	.header_img {
		margin-right: 10px;
	}

	.header_img image {
		width: 20px;
		height: 20px;
	}

	.header_sm {
		color: rgba(16, 16, 16, 1);
		font-size: 14px;
		text-align: left;
	}

	.header_pl {
		margin-left: 5%;
		width: 90%;
		text-align: center;
		border-bottom: 0.5px solid #FAFAFA;
	}

	.header_bs {
		display: flex;
		flex-direction: row;
	}

	.header_bs input {
		margin-right: 10px;
		margin-left: 10px;
		background-color: #e7e7e7;
		width: 30px;
		text-align: center;
	}

	.header_bs image {
		width: 20px;
		height: 20px;
	}

	.header_z {
		line-height: 28px;
	}

	.header_hb {
		display: flex;
		justify-content: space-around;
		align-items: center;
		text-align: center;
		padding-bottom: 5px;
	}

	.header_x {
		border-top: 1px solid #DFDFDF;
		margin-top: 10px;
	}

	.header_x_top {
		border-top: 1px solid #DFDFDF;
	}

	.header_one_text {
		font-size: 15px;
		width: 64px;
	}

	.header_one_text image {
		width: 20px;
		height: 20px;
		border-radius: 50%;
	}

	.header_view {
		display: flex;
		justify-content: space-around;
		align-items: center;
		text-align: center;
		padding-bottom: 5px;
		font-size: 12px;
	}
</style>
